﻿using B.S.Domain.基础数据.客户管理;
using B.S.Infratrctrue;
using B.S.Requst;
using MediatR;

namespace B.S.Data.MES.API.Applications.Dingdan
{
    public class clientQueryCommandHandler : IRequestHandler<clientQueryCommand, APIRequst<List<client>>>
    {
        public clientQueryCommandHandler(IBaseRepository<client> clientRepository)
        {
            ClientRepository = clientRepository;
        }

        public IBaseRepository<client> ClientRepository { get; }

        public Task<APIRequst<List<client>>> Handle(clientQueryCommand request, CancellationToken cancellationToken)
        {
            var path = ClientRepository.GetAll().ToList();
            return Task.FromResult(new APIRequst<List<client>> { Code = RequstCode.成功, Msg = "查询成功", Data = path });
        }
    }
}
